Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #38072 - add host bootc_images endpoint #11257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ianballou
Copy link
Member

What are the changes introduced in this pull request?

Adds a new /hosts/bootc_images endpoint that returns an overview of all bootc images that hosts are using.

The return data looks like the following:

{
  "total": 499,
  "bootc_images": [
    [
      "quay.io/centos-bootc/centos-bootc:stream10",
      [
        {
          "bootc_booted_digest": "sha256:54256a998f0c62e16f3927c82b570f90bd8449a52e03daabd5fd16d6419fd572",
          "host_count": 1
        }
      ]
    ]
  ]
}

This data will power a page that shows a list of image paths and each image mode host that is using that image path. Since each host could use the same image but a different digest, each image path holds any number of digests with the count of hosts that are using that digest. More digests per image path means more drift from the latest container content under that container tag.

Considerations taken when implementing this change?

Choosing where this goes was difficult -- it's related to hosts so I decided to stick it under the hosts endpoint. I use facts as a similar paradigm: host facts and bootc images are both aggregate information from hosts that are available at a single API endpoint.

What are the testing steps for this pull request?

  1. Make a bunch of different bootc hosts. You can use the following script to create one clone:
#!/bin/bash

uuid=$(uuidgen)
short=$(hostname -s)
domain=manicotto.example.com
echo "{\"dmi.system.uuid\": \"${uuid}\"}" > /etc/rhsm/facts/uuid.facts
hostnamectl set-hostname ${short}.${uuid%%-*}.${domain}
subscription-manager clean
subscription-manager register --activationkey "Default Library Key" --org "Default_Organization"
  1. Query the endpoint, test with and without paging
curl "https://`hostname`/api/hosts/bootc_images?per_page=5&page=7" -uadmin:pass
  1. Ensure that empty conditions work, check page sizes that don't make sense, etc.

@ianballou
Copy link
Member Author

Rubocop errors are unrelated & on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant